Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment to use iterators more and directly use either st_asgeojson/st_asewkt depending on output type. #77

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bitner
Copy link
Contributor

@bitner bitner commented Nov 15, 2022

Experiment to use streaming responses from iterators for csv, ndjson, geojsonseq, directly alternate between st_asgeojson/st_asewkt, and to use iterators for looping through items rather than lists.

There's no QA and a bunch of artifacts from just playing around.... lots probably broken ... definitely not ready to merge!

Benchmarks all run on my local system.

this branch benchmarks

------------------------------------------------------- benchmark 'Big Feature': 4 tests ------------------------------------------------------
Name (time in ms)                                               Min                   Max                  Mean                Median          
-----------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_item[html-Saskatchewan]                      32.0783 (1.0)        143.3303 (1.20)        55.0646 (1.0)         35.7708 (1.0)    
test_benchmark_item[geojson-Saskatchewan]                   60.0197 (1.87)       119.3344 (1.0)         82.6221 (1.50)        75.0889 (2.10)   
test_benchmark_item[html-NewfoundlandandLabrador]        1,123.1473 (35.01)    1,223.4175 (10.25)    1,151.5889 (20.91)    1,143.1331 (31.96)  
test_benchmark_item[geojson-NewfoundlandandLabrador]     1,614.1873 (50.32)    1,682.4940 (14.10)    1,646.9079 (29.91)    1,630.9634 (45.59)  
-----------------------------------------------------------------------------------------------------------------------------------------------

------------------------------------- benchmark 'Items: csv': 6 tests --------------------------------------
Name (time in ms)                     Min                Max               Mean             Median          
------------------------------------------------------------------------------------------------------------
test_benchmark_items[csv-1]        2.6586 (1.0)       4.3753 (1.0)       2.8361 (1.0)       2.7526 (1.0)    
test_benchmark_items[csv-10]       3.0402 (1.14)      5.1300 (1.17)      3.2489 (1.15)      3.1891 (1.16)   
test_benchmark_items[csv-50]       4.3329 (1.63)      6.9656 (1.59)      4.6580 (1.64)      4.5709 (1.66)   
test_benchmark_items[csv-100]      6.0603 (2.28)     43.0131 (9.83)      7.0813 (2.50)      6.6169 (2.40)   
test_benchmark_items[csv-200]      9.8291 (3.70)     48.3190 (11.04)    11.4363 (4.03)     10.1519 (3.69)   
test_benchmark_items[csv-250]     11.5922 (4.36)     47.9561 (10.96)    13.4329 (4.74)     12.0478 (4.38)   
------------------------------------------------------------------------------------------------------------

------------------------------------- benchmark 'Items: geojson': 6 tests --------------------------------------
Name (time in ms)                         Min                Max               Mean             Median          
----------------------------------------------------------------------------------------------------------------
test_benchmark_items[geojson-1]        4.4294 (1.0)       5.8338 (1.0)       4.5860 (1.0)       4.5277 (1.0)    
test_benchmark_items[geojson-10]       5.3221 (1.20)      9.6607 (1.66)      5.7268 (1.25)      5.5102 (1.22)   
test_benchmark_items[geojson-50]       9.2985 (2.10)     47.5246 (8.15)     10.7666 (2.35)     10.0145 (2.21)   
test_benchmark_items[geojson-100]     13.6450 (3.08)     52.4830 (9.00)     15.1371 (3.30)     14.2678 (3.15)   
test_benchmark_items[geojson-200]     23.0456 (5.20)     62.5609 (10.72)    27.5773 (6.01)     23.8257 (5.26)   
test_benchmark_items[geojson-250]     27.7224 (6.26)     67.0630 (11.50)    34.1981 (7.46)     28.8122 (6.36)   
----------------------------------------------------------------------------------------------------------------

-------------------------------------- benchmark 'Items: html': 6 tests -------------------------------------
Name (time in ms)                      Min                Max               Mean             Median          
-------------------------------------------------------------------------------------------------------------
test_benchmark_items[html-1]        4.8176 (1.0)       6.6003 (1.0)       5.3492 (1.0)       5.2668 (1.0)    
test_benchmark_items[html-10]       5.1932 (1.08)      9.7061 (1.47)      6.0031 (1.12)      5.6843 (1.08)   
test_benchmark_items[html-50]       7.1602 (1.49)     45.6864 (6.92)      8.8322 (1.65)      8.1590 (1.55)   
test_benchmark_items[html-100]      9.2472 (1.92)     52.8468 (8.01)     13.3346 (2.49)     10.5302 (2.00)   
test_benchmark_items[html-200]     14.7147 (3.05)     66.8465 (10.13)    21.7357 (4.06)     16.4997 (3.13)   
test_benchmark_items[html-250]     17.1737 (3.56)     68.8733 (10.43)    25.2962 (4.73)     19.1995 (3.65)   
-------------------------------------------------------------------------------------------------------------

master benchmarks

--------------------------------------------------------- benchmark 'Big Feature': 4 tests --------------------------------------------------------
Name (time in ms)                                                Min                    Max                   Mean                 Median
---------------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_item[html-Saskatchewan]                      391.4772 (1.0)         509.9929 (1.0)         433.5239 (1.0)         436.2343 (1.0)
test_benchmark_item[geojson-Saskatchewan]                   521.0502 (1.33)        602.7388 (1.18)        559.4799 (1.29)        558.3038 (1.28)
test_benchmark_item[html-NewfoundlandandLabrador]         9,599.0378 (24.52)    10,036.5909 (19.68)     9,705.2822 (22.39)     9,618.5565 (22.05)
test_benchmark_item[geojson-NewfoundlandandLabrador]     12,244.1749 (31.28)    14,592.5904 (28.61)    13,159.2756 (30.35)    12,853.7977 (29.47)
---------------------------------------------------------------------------------------------------------------------------------------------------

--------------------------------------- benchmark 'Items: csv': 6 tests ----------------------------------------
Name (time in ms)                      Min                 Max                Mean              Median
----------------------------------------------------------------------------------------------------------------
test_benchmark_items[csv-1]         4.7654 (1.0)        9.2321 (1.0)        5.2909 (1.0)        4.9046 (1.0)
test_benchmark_items[csv-10]       12.0929 (2.54)      23.9649 (2.60)      19.8546 (3.75)      22.7625 (4.64)
test_benchmark_items[csv-50]       36.4100 (7.64)      66.9855 (7.26)      46.9375 (8.87)      39.7777 (8.11)
test_benchmark_items[csv-100]      65.3648 (13.72)    122.6060 (13.28)     72.4354 (13.69)     67.0744 (13.68)
test_benchmark_items[csv-200]     127.2617 (26.71)    135.7212 (14.70)    131.5773 (24.87)    131.5792 (26.83)
test_benchmark_items[csv-250]     159.2361 (33.42)    167.4841 (18.14)    162.1038 (30.64)    161.4800 (32.92)
----------------------------------------------------------------------------------------------------------------

--------------------------------------- benchmark 'Items: geojson': 6 tests ----------------------------------------
Name (time in ms)                          Min                 Max                Mean              Median
--------------------------------------------------------------------------------------------------------------------
test_benchmark_items[geojson-1]         6.6537 (1.0)       11.6314 (1.0)        7.2062 (1.0)        7.0215 (1.0)
test_benchmark_items[geojson-10]       23.0312 (3.46)      27.0355 (2.32)      23.4830 (3.26)      23.3318 (3.32)
test_benchmark_items[geojson-50]       85.7948 (12.89)     89.0247 (7.65)      87.1449 (12.09)     86.3314 (12.30)
test_benchmark_items[geojson-100]     168.4671 (25.32)    177.3681 (15.25)    170.5466 (23.67)    169.0641 (24.08)
test_benchmark_items[geojson-200]     334.5783 (50.28)    378.9773 (32.58)    352.3985 (48.90)    335.6240 (47.80)
test_benchmark_items[geojson-250]     414.1491 (62.24)    463.2121 (39.82)    442.7808 (61.44)    459.9878 (65.51)
--------------------------------------------------------------------------------------------------------------------

---------------------------------------- benchmark 'Items: html': 6 tests ---------------------------------------
Name (time in ms)                       Min                 Max                Mean              Median
-----------------------------------------------------------------------------------------------------------------
test_benchmark_items[html-1]         6.3596 (1.0)       45.5747 (1.85)       8.6734 (1.0)        7.2908 (1.0)
test_benchmark_items[html-10]       18.9107 (2.97)      24.6630 (1.0)       19.6494 (2.27)      19.4158 (2.66)
test_benchmark_items[html-50]       68.2333 (10.73)     89.7137 (3.64)      71.1327 (8.20)      69.2499 (9.50)
test_benchmark_items[html-100]     130.5266 (20.52)    171.8858 (6.97)     138.3333 (15.95)    131.7616 (18.07)
test_benchmark_items[html-200]     261.1059 (41.06)    315.2906 (12.78)    283.2920 (32.66)    264.3431 (36.26)
test_benchmark_items[html-250]     325.9797 (51.26)    403.3001 (16.35)    361.3917 (41.67)    374.9489 (51.43)
-----------------------------------------------------------------------------------------------------------------

NoSerialisation branch benchmarks

------------------------------------------------------- benchmark 'Big Feature': 4 tests ------------------------------------------------------
Name (time in ms)                                               Min                   Max                  Mean                Median
-----------------------------------------------------------------------------------------------------------------------------------------------
test_benchmark_item[html-Saskatchewan]                      62.6307 (1.0)        164.6017 (1.0)         87.4238 (1.0)         69.9407 (1.0)
test_benchmark_item[geojson-Saskatchewan]                   81.8636 (1.31)       255.6037 (1.55)       132.2086 (1.51)        94.5664 (1.35)
test_benchmark_item[html-NewfoundlandandLabrador]        1,749.8637 (27.94)    2,220.2697 (13.49)    1,929.1738 (22.07)    1,895.6169 (27.10)
test_benchmark_item[geojson-NewfoundlandandLabrador]     2,188.3228 (34.94)    2,342.5656 (14.23)    2,260.7816 (25.86)    2,258.6627 (32.29)
-----------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------- benchmark 'Items: csv': 6 tests --------------------------------------
Name (time in ms)                     Min                 Max               Mean             Median
-------------------------------------------------------------------------------------------------------------
test_benchmark_items[csv-1]        9.0424 (1.0)       33.8002 (1.0)      17.7355 (1.0)      15.2862 (1.0)
test_benchmark_items[csv-10]      16.1270 (1.78)      48.3782 (1.43)     23.2693 (1.31)     20.0302 (1.31)
test_benchmark_items[csv-50]      21.4578 (2.37)      69.3793 (2.05)     42.3058 (2.39)     42.3680 (2.77)
test_benchmark_items[csv-100]     25.0390 (2.77)      68.8228 (2.04)     32.9675 (1.86)     25.8125 (1.69)
test_benchmark_items[csv-200]     47.0930 (5.21)     165.6855 (4.90)     67.4966 (3.81)     53.4727 (3.50)
test_benchmark_items[csv-250]     56.9376 (6.30)     127.4536 (3.77)     66.8734 (3.77)     60.4200 (3.95)
-------------------------------------------------------------------------------------------------------------

--------------------------------------- benchmark 'Items: geojson': 6 tests ---------------------------------------
Name (time in ms)                         Min                 Max                Mean              Median
-------------------------------------------------------------------------------------------------------------------
test_benchmark_items[geojson-1]        4.3544 (1.0)       10.3360 (1.0)        5.3257 (1.0)        4.9153 (1.0)
test_benchmark_items[geojson-10]       7.8628 (1.81)      14.9767 (1.45)       9.0516 (1.70)       8.5329 (1.74)
test_benchmark_items[geojson-50]      19.8730 (4.56)      81.4429 (7.88)      30.0976 (5.65)      21.5299 (4.38)
test_benchmark_items[geojson-100]     33.7474 (7.75)     110.7455 (10.71)     44.0837 (8.28)      37.2895 (7.59)
test_benchmark_items[geojson-200]     63.8863 (14.67)    246.8521 (23.88)    145.0718 (27.24)    143.2468 (29.14)
test_benchmark_items[geojson-250]     81.2029 (18.65)    233.4930 (22.59)    113.1490 (21.25)    102.7409 (20.90)
-------------------------------------------------------------------------------------------------------------------

-------------------------------------- benchmark 'Items: html': 6 tests --------------------------------------
Name (time in ms)                      Min                 Max               Mean             Median
--------------------------------------------------------------------------------------------------------------
test_benchmark_items[html-1]        4.3532 (1.0)        6.6817 (1.0)       5.1943 (1.0)       5.0733 (1.0)
test_benchmark_items[html-10]       7.1103 (1.63)      42.9535 (6.43)     12.1134 (2.33)      8.1353 (1.60)
test_benchmark_items[html-50]      19.8367 (4.56)     148.4927 (22.22)    37.1518 (7.15)     31.4381 (6.20)
test_benchmark_items[html-100]     42.8403 (9.84)     178.8954 (26.77)    65.9302 (12.69)    58.5890 (11.55)
test_benchmark_items[html-200]     57.0397 (13.10)    180.0891 (26.95)    83.0947 (16.00)    69.8658 (13.77)
test_benchmark_items[html-250]     66.9560 (15.38)    124.3747 (18.61)    79.4139 (15.29)    69.2508 (13.65)
--------------------------------------------------------------------------------------------------------------

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant