pcb-rnd knowledge pool

 

Query() performance test 2020

query_speed by Tibor 'Igor2' Palinkas on 2020-05-16

Tags: insight, query, performance, speed, expression, search

node source

 

 

Abstract: n/a

 

Test environment

The test script was running on an intel i5-3470 @ 3.2Ghz, circa 2013. The test board has a grid of 10000 identical line objects. Results are the 'user' line of bash 'time' output and represent 1000 pairs of select/unselect operation matching all 10k objects on the board. The executable was pcb-rnd r31411 compiled with -O3.

Test 1: Iteration speed

The first test compares query() setup cost and iteration speed to conventional Select(All) and Unselect(All). This gives a picture on the overhead of the query() infrastructure.

test case total run time [s]
Select()/Unselect() 1.967
query, @ 0.940
query, @.type == LINE 1.339
query, (@.type == LINE) && (@.thickness > 0.1mil) && (@.thickness < 1000mil) && (@.layer.type == COPPER) 4.753

Test 2: String handling

The second test measures string comparison and regex matching speed against against plain numeric queries above.

test case total run time [s]
query, (@.layer.type == COPPER) 1.616
query, (@.layer.name == "top-sig") 1.542
query, (@.layer.name ~ "top-sig") 1.858

Conclusion

The fixed overhead of the query() system for object listing is lower than the overhead of the rtree search in Select(). Expression evaluation cost is measurable, although not drastic for the usual short searches. The cost of regex matching is only sligtly higher than the cost of plain string comparison.