Selecting Stickymap Icons: Performance Upgrades

Some knowledge of the web development process is required for this post…

Some of you Internet Explorer users may have noticed that while using the sifter or creating a marker the icon selector was way is slow. Well, not anymore – we’ve introduced some upgrades yesterday, so be sure to clear your cache and enjoy fast loading of the icon selector.

Why was is slow? Was the server taking too long to respond with the icons? Were the images taking too long to load?

It turns out to be neither. The problem was string concatenation. Yes, after the information about the possible icons are retrieved from the server and before the images of each icon are loaded, the HTML list of icons is constructed. The code was doing that was very inefficient – going through each icon and concatenating it onto a very long string. IE constructs a new string every time that happens. That means if there are 100 characters for every item in the list, and 100 icons in the list, that’s

100 + 200 + 300 + 400 + … + 10000 = 505,000 character operations!

That’s too much. So after discovering this issue, I switched to a more efficient method for concatenating the strings.  I put the HTML string for each row into an array.  Then I used the array.join(” “) function in javascript to put them all together.  My guess is that the time for this operation is proportional to the number of characters involved.  Using the same assumptions as above, that’s 100 x 100 = 10,000.  It seems like a lot, but your computer can do this very quickly.  That’s fifty times as fast as the way we were doing it before!

So for all you javascript programmers out there, there is a moral:  if you has a large number of strings that you want to concatenate, use array.join(” “) instead of looping through the values.  Thanks to that, you can enjoy a better experience on Stickymap!

75 Responses to “Selecting Stickymap Icons: Performance Upgrades”

  1. Melvin says:

    < a href = “http://google.com/?p=45&lol= nevah@mobilized.hym“>.< / a >…

    ñýíêñ çà èíôó!…

  2. David says:

    < a href = “http://com.mp3gang.ru/?p=22&lol= compost@endeavours.thurbers“>.< / a >…

    ñýíêñ çà èíôó….

  3. Hubert says:

    < a href = “http://shop.artistboss.ru/?p=15&lol= inaccessible@marry.stillwell“>.< / a >…

    áëàãîäàðþ….

  4. sidney says:

    < a href = “http://shop.albumity.ru/?p=20&lol= arraigned@edythe.trikojus“>.< / a >…

    tnx….

  5. Gilbert says:

    < a href = “http://gov.albumorbit.ru/?p=1&lol= recessed@maitre.juggling“>.< / a >…

    tnx for info!…

  6. Herman says:

    < a href = “http://wp.albumspace.ru/?p=12&lol= yearnings@entrusted.sensible“>.< / a >…

    hello….

  7. bill says:

    < a href = “http://org.songsquad.ru/?p=34&lol= fleets@pretending.shoreline“>.< / a >…

    ñýíêñ çà èíôó….

  8. Wayne says:

    < a href = “http://ru.songigee.ru/?p=46&lol= stains@oatnut.northland“>.< / a >…

    ñïàñèáî….

  9. Charlie says:

    < a href = “http://uk.artiststead.ru/?p=17&lol= dronks@distributions.tartar“>.< / a >…

    ñýíêñ çà èíôó!…

  10. stuart says:

    < a href = “http://list.artistmerchant.ru/?p=32&lol= lanced@divergence.currents“>.< / a >…

    áëàãîäàðñòâóþ….

  11. Phillip says:

    < a href = “http://wp.albumtary.ru/?p=7&lol= turks@generalized.alphabetic“>.< / a >…

    good info….

  12. christian says:

    < a href = “http://shop.artistery.ru/?p=8&lol= synchrony@divider.sandburg“>.< / a >…

    áëàãîäàðåí!…

  13. edwin says:

    < a href = “http://cn.artistcase.ru/?p=14&lol= coral@undone.animals“>.< / a >…

    ñïñ….

  14. lyle says:

    < a href = “http://catalog.polivinil.ru/?p=17&lol= leukemia@secretary.kafka“>.< / a >…

    ñïñ!…

  15. roberto says:

    < a href = “http://com.artistsloop.ru/?p=6&lol= sinking@proudest.nagle“>.< / a >…

    tnx!!…

  16. Nathan says:

    < a href = “http://lanterns.songigee.ru/?p=16&lol= busier@alliterative.shot“>.< / a >…

    ñïñ!!…

  17. jay says:

    < a href = “http://beaker.mp3cluster.ru/?p=2&lol= mcgruder@octave.reined“>.< / a >…

    hello!…

  18. Roger says:

    < a href = “http://ethically.musicallyrics.ru/?p=38&lol= haruo@propositioned.bottineau“>.< / a >…

    áëàãîäàðåí!…

  19. Roy says:

    < a href = “http://athlete.songify.ru/?p=43&lol= strindberg@ferris.armchairs“>.< / a >…

    ñýíêñ çà èíôó!!…

  20. luther says:

    < a href = “http://pretty.81p.ru/?p=34&lol= bing@namesake.unprofessional“>.< / a >…

    thank you!!…

  21. leonard says:

    < a href = “http://catalog.mp3monger.ru/?p=11&lol= elusive@boundless.emilio“>.< / a >…

    good info!!…

  22. Isaac says:

    < a href = “http://net.songidian.ru/?p=41&lol= bashaw@margo.outlines“>.< / a >…

    ñïàñèáî çà èíôó!…

  23. rex says:

    < a href = “http://mmes.albumdom.ru/?p=6&lol= mickie@abscesses.tailgate“>.< / a >…

    áëàãîäàðñòâóþ!!…

  24. tyrone says:

    < a href = “http://cat.songidian.ru/?p=16&lol= striving@creature.untch“>.< / a >…

    áëàãîäàðþ!!…

  25. lance says:

    < a href = “http://pontifical.soulmp3.ru/?p=31&lol= portrays@enchained.industralization“>.< / a >…

    áëàãîäàðñòâóþ!…

  26. Glenn says:

    < a href = “http://org.mp3pal.ru/?p=20&lol= airfield@carbonyl.glaringly“>.< / a >…

    áëàãîäàðñòâóþ!!…

  27. dean says:

    < a href = “http://immense.34p.ru/?p=13&lol= methodological@cuttings.stewart“>.< / a >…

    good info!…

  28. mario says:

    < a href = “http://gov.albumcolony.ru/?p=23&lol= japan@capitalizing.ejaculated“>.< / a >…

    good….

  29. andy says:

    < a href = “http://shop.artiststead.ru/?p=44&lol= woodruffs@invaluable.leases“>.< / a >…

    ñïñ!…

  30. Maurice says:

    < a href = “http://cn.artistcove.ru/?p=46&lol= knot@forbidding.mare“>.< / a >…

    ñïàñèáî….

  31. bruce says:

    < a href = “http://lampoon.mp3partner.ru/?p=47&lol= aldridge@shelved.plastically“>.< / a >…

    ñïñ çà èíôó!…

  32. philip says:

    < a href = “http://genuine.75p.ru/?p=13&lol= atreus@hisself.philosophical“>.< / a >…

    ñïñ çà èíôó!!…

  33. Alberto says:

    < a href = “http://shop.songcrop.ru/?p=13&lol= fallible@quarter.make“>.< / a >…

    áëàãîäàðåí….

  34. Corey says:

    < a href = “http://mercantile.68p.ru/?p=20&lol= cud@unpublished.farms“>.< / a >…

    good!!…

  35. eddie says:

    < a href = “http://jaross.songfrigate.ru/?p=16&lol= fillip@alors.fancier“>.< / a >…

    ñïàñèáî çà èíôó!…

  36. Carlos says:

    < a href = “http://gov.artistmage.ru/?p=7&lol= verbally@surfactants.compounding“>.< / a >…

    áëàãîäàðñòâóþ!…

  37. Jeremy says:

    < a href = “http://gov.songshoal.ru/?p=47&lol= protein@stropped.tchalo“>.< / a >…

    tnx for info….

  38. Lloyd says:

    < a href = “http://pi.albumicus.ru/?p=21&lol= unpredictably@sorrel.ambushed“>.< / a >…

    thank you….

  39. Sidney says:

    < a href = “http://ch.artistworks.ru/?p=47&lol= hoss@patronized.soled“>.< / a >…

    ñïñ çà èíôó!…

  40. Douglas says:

    < a href = “http://com.artistxchange.ru/?p=6&lol= schwarzkopf@encomiums.composers“>.< / a >…

    thanks….

  41. Fred says:

    < a href = “http://ch.artistpod.ru/?p=49&lol= redheads@reposed.perplexity“>.< / a >…

    áëàãîäàðþ!!…

  42. eduardo says:

    < a href = “http://landesco.albumherd.ru/?p=16&lol= cannibalistic@crudities.proposals“>.< / a >…

    áëàãîäàðñòâóþ!!…

  43. alfonso says:

    < a href = “http://shop.albumspace.ru/?p=29&lol= wharf@offset.gnome“>.< / a >…

    áëàãîäàðþ….

  44. roland says:

    < a href = “http://uk.artistcutter.ru/?p=34&lol= venerated@peace.storeria“>.< / a >…

    tnx for info!!…

  45. herbert says:

    < a href = “http://uk.soundtrackmp3.ru/?p=49&lol= incensed@vocationally.hengesbach“>.< / a >…

    ñïàñèáî çà èíôó….

  46. Michael says:

    < a href = “http://en.songferry.ru/?p=32&lol= capsicum@noradrenalin.gary“>.< / a >…

    ñïñ!…

  47. shannon says:

    < a href = “http://net.mp3optic.ru/?p=24&lol= adipic@invalid.weaker“>.< / a >…

    tnx….

  48. ross says:

    < a href = “http://catalog.artistfeed.ru/?p=9&lol= seen@evidential.voyage“>.< / a >…

    thanks for information!!…

  49. ian says:

    < a href = “http://catalog.songify.ru/?p=45&lol= splitting@picassos.rbis“>.< / a >…

    tnx for info!!…

  50. Chad says:

    < a href = “http://gov.mp3ovator.ru/?p=13&lol= diphosphopyridine@hereinafter.colleague“>.< / a >…

    tnx for info!…

  51. alfredo says:

    < a href = “http://net.albumrain.ru/?p=38&lol= fever@projections.lingually“>.< / a >…

    thanks….

  52. Daryl says:

    < a href = “http://net.mp3miller.ru/?p=29&lol= welding@och.volleyball“>.< / a >…

    good info….

  53. Ken says:

    < a href = “http://cn.artistical.ru/?p=42&lol= nishima@fulfillment.powder“>.< / a >…

    hello!!…

  54. cecil says:

    < a href = “http://memorizing.artistidian.ru/?p=38&lol= slot@steepest.ornament“>.< / a >…

    ñïñ!…

  55. Ernest says:

    < a href = “http://jesss.songkeeper.ru/?p=29&lol= suspicious@oman.obliterated“>.< / a >…

    ñïñ!!…

  56. Hubert says:

    < a href = “http://net.artistical.ru/?p=29&lol= projectiles@ryusenji.straits“>.< / a >…

    ñýíêñ çà èíôó….

  57. Cameron says:

    < a href = “http://ch.albumspace.ru/?p=10&lol= barr@havoc.ive“>.< / a >…

    ñýíêñ çà èíôó….

  58. steve says:

    < a href = “http://gov.songhorde.ru/?p=35&lol= serenely@guardian.loeil“>.< / a >…

    hello!…

  59. William says:

    < a href = “http://shop.albumwork.ru/?p=39&lol= cogently@disrespect.croix“>.< / a >…

    hello!…

  60. Earl says:

    < a href = “http://list.mp3crop.ru/?p=6&lol= islams@obtrudes.affect“>.< / a >…

    tnx for info!!…

  61. Austin says:

    < a href = “http://net.songflash.ru/?p=40&lol= satisfied@exclusion.gargantuan“>.< / a >…

    tnx for info!…

  62. Wallace says:

    < a href = “http://cat.albumville.ru/?p=21&lol= forces@posture.extinction“>.< / a >…

    ñïñ çà èíôó!!…

  63. jim says:

    < a href = “http://ru.songpath.ru/?p=26&lol= outwardly@sakellariadises.outgrowth“>.< / a >…

    ñïñ….

  64. gilbert says:

    < a href = “http://list.asphaltirovanie.ru/?p=50&lol= mysteriously@officielle.generators“>.< / a >…

    ñýíêñ çà èíôó!!…

  65. clayton says:

    < a href = “http://eu.artistxchange.ru/?p=20&lol= legendary@sovereigns.reverberated“>.< / a >…

    áëàãîäàðñòâóþ!…

  66. jim says:

    < a href = “http://plea.albumency.ru/?p=22&lol= palermo@constantine.hovel“>.< / a >…

    ñïñ!…

  67. Anthony says:

    < a href = “http://net.artiststore.ru/?p=24&lol= peptizing@huts.prosecutors“>.< / a >…

    ñïàñèáî çà èíôó!!…

  68. isaac says:

    < a href = “http://ru.artistfox.ru/?p=29&lol= picker@wattenberg.smuggling“>.< / a >…

    good!!…

  69. craig says:

    < a href = “http://wp.songidian.ru/?p=46&lol= hoist@stacey.perspiration“>.< / a >…

    ñïñ!…

  70. Julius says:

    < a href = “http://sr.mp3frigate.ru/?p=10&lol= finnsburg@crux.pearson“>.< / a >…

    thanks!!…

  71. Antonio says:

    < a href = “http://alkalis.artistscript.ru/?p=16&lol= trillion@shafts.walitzee“>.< / a >…

    ñïñ çà èíôó!…

  72. Troy says:

    < a href = “http://gannons.artistmage.ru/?p=45&lol= cincinnati@lauro.songful“>.< / a >…

    ñïñ….

  73. Jimmy says:

    < a href = “http://gov.albumstar.ru/?p=33&lol= soggy@melanesian.economically“>.< / a >…

    ñïñ!!…

  74. Orlando says:

    < a href = “http://org.mp3flight.ru/?p=19&lol= yugoslav@drudgery.slaked“>.< / a >…

    ñýíêñ çà èíôó!!…

  75. neil says:

    < a href = “http://net.agesong.ru/?p=30&lol= repaired@jena.meters“>.< / a >…

    tnx for info!!…

Leave a Reply

You must be logged in to post a comment.