Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1044

Significant performance improvement in E_Bound

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Jena 3.0.1
    • Component/s: None
    • Labels:
      None

      Description

      I would like to suggest a significant performance improvement that I've seen occurring in various setups. Basically the issue occurs if you do a bound(?somethingthatsnotbound) this causes an "internal" runtime exception to be thrown down in the code which in turn is caught and handled by returning a false from E_Bound. This only occurs in the case of a bound(?x) returning false. This is an issue as runtimeexceptions are very costly and if you do this quite a lot in your query or attempt to do many queries that have lots of bound() functions in them you can end up with significant performance degradation.

      Suggested fix in E_Bound.java

      @Override
      	public NodeValue evalSpecial(Binding binding, FunctionEnv env)
      	{ 
      		if (expr instanceof NodeValue){
      			return NodeValue.TRUE; // probably just our code has this case as we do some prebindings.
      		} else {
      			return binding.contains(expr.asVar()) ? NodeValue.TRUE : NodeValue.FALSE; 
      		}
      	} 
      

        Attachments

        1. PercentTime_clean.png
          25 kB
          Robert Mercer
        2. RuntimeException_clean.png
          247 kB
          Robert Mercer

          Activity

            People

            • Assignee:
              andy Andy Seaborne
              Reporter:
              TQDevRob Robert Mercer
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: