Skip to content

Commit

Permalink
Improve parser performance by removing old JDT/JIT tuning
Browse files Browse the repository at this point in the history
This change made the parser run between 8 and 12% faster
  • Loading branch information
DavyLandman committed Jun 18, 2023
1 parent f2e37a0 commit 12aed30
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 12aed30

Please sign in to comment.