Skip to content

Commit

Permalink
Merge pull request #1813 from usethesource/parser-performance
Browse files Browse the repository at this point in the history
Improve parser performance by removing old JDT/JIT tuning
  • Loading branch information
jurgenvinju authored Jun 18, 2023
2 parents f2e37a0 + 12aed30 commit 2331fec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/org/rascalmpl/parser/gtd/stack/edge/EdgesSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
*******************************************************************************/
package org.rascalmpl.parser.gtd.stack.edge;

import java.util.Arrays;

import org.rascalmpl.parser.gtd.result.AbstractContainerNode;
import org.rascalmpl.parser.gtd.stack.AbstractStackNode;
import org.rascalmpl.parser.gtd.util.IntegerMap;
Expand Down Expand Up @@ -48,10 +50,9 @@ public EdgesSet(int initialSize){
}

private void enlarge(){
AbstractStackNode<P>[] oldEdges = edges;
edges = (AbstractStackNode<P>[]) new AbstractStackNode[size << 1];
System.arraycopy(oldEdges, 0, edges, 0, size);
edges = Arrays.copyOf(edges, size << 1, edges.getClass());
}


public void add(AbstractStackNode<P> edge){
while(size >= edges.length){ // While instead of if to enable the JIT to eliminate the bounds check on the edges array
Expand Down

0 comments on commit 2331fec

Please sign in to comment.