Jump to content

Search the Community

Showing results for tags 'fastest'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • People Forum
    • Your Avatar
    • Make Friends
    • Lifestyles and Relationships
    • Role Play
    • General Discussion Forum
    • Forums Feedback
    • Missed Connections
    • Second Life Education
  • Places and Events Forum
    • Favorite Destinations
    • Upcoming Events and Activities
    • Games in Second Life
  • Official Contests & Events
    • Leap Into Love Snapshot Contest
  • Creation Forum
    • Fashion
    • Art, Music and Photography
    • Animation Forum
    • Bakes on Mesh
    • Environmental Enhancement Project
    • Machinima Forum
    • Building and Texturing Forum
    • Mesh
    • LSL Scripting
    • LSL Library
    • Sansar for Second Life Residents
  • Technology Forum
    • Second Life Server
    • Second Life Viewer
    • Second Life Web
    • General Second Life Tech Discussion
  • Commerce Forum
    • Merchants
    • Inworld Employment
    • Wanted
  • Land Forum
    • General Discussion
    • Mainland
    • Linden Homes
    • Regions for Sale: Full Private Island
    • Region for Rent: Full Private Island
    • Regions for Sale: Homesteads
    • Region Rentals: Homestead
    • Parcels for Sale: Mainland
    • Parcels for Rent: Mainland
    • Wanted: Full Private Island
    • Wanted: Homesteads
    • Wanted: Mainland
  • International Forum
    • Deutsches Forum
    • Foro en español
    • Forum in italiano
    • Forum français
    • 日本語フォーラム
    • 한국어 포럼
    • Fórum em português
    • Forum polskie
    • المنتدى العربي
    • Türkçe Forum
    • Форум по-русски
  • Adult Content Forum
    • Highlight Upcoming Events
    • General Discussion
    • General Announcements
  • Answers
    • Abuse and Griefing
    • Account
    • Avatar
    • Creation
    • Inventory
    • Getting Started
    • Controls
    • Land
    • Linden Dollars (L$)
    • Shopping
    • Technical
    • Viewers
    • Everything Else
    • International Answers

Blogs

  • Commerce
  • Featured News
  • Inworld
  • Tools and Technology
  • Tips and Tricks
  • Land

Categories

  • English
  • Deutsch
  • Français
  • Español
  • Português
  • 日本語
  • Italiano
  • Pусский
  • Türkçe

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 1 result

  1. So a little while back, while the forums were offline for the new site update, I had a question I wanted answered: what loops are fastest in mono, and what stipulations should be taken into account when scripting them? As it turns out, this is quite an interesting topic that has a lot of commentators scratching their heads. Well, I'm not here to talk about efficiency, but I am here to definitively conclude which loops appear to be fastest (and when they usually are). Using a simple script that can be found below, I conducted some tests (in mono) to see what loops finish fastest with no arguments inside of them to test the true speed of the loop itself, from a practical approach without considering the theory behind it. My results could be considered a little odd, as the answer of 'fastest' actually appears to vary based on how many iterations you happen to be looping through. The results of my particular test are printed below, as concluded by the script found at the end of the page: 'for' loop time to 100: 0.000000 'for' loop time to 1,000: 0.024513 'for' loop time to 10,000: 0.044505 'for' loop time to 100,000: 0.596119 'for' loop time to 1,000,000: 6.318980 'do-while' loop time to 100: 0.000000 'do-while' loop time to 1,000: 0.030374 'do-while' loop time to 10,000: 0.114235 'do-while' loop time to 100,000: 1.198419 'do-while' loop time to 1,000,000: 12.739420 'while' loop time to 100: 0.000000 'while' loop time to 1,000: 0.014845 'while' loop time to 10,000: 0.116710 'while' loop time to 100,000: 1.200627 'while' loop time to 1,000,000: 12.317580 loop time to 100: All loops evenly matched for practical purposes. loop time to 1,000: 'while' loops beats all; 0.015529 seconds faster than 'do-while', and 0.009268 seconds faster than 'for'. loop time to 10,000: 'for' loop beats all; 0.06973 seconds faster than 'do-while', and 0.072205 seconds faster than 'while'. loop time to 100,000: for loop beats all; 0.6023 seconds faster than 'do-while', and 0.604508 seconds faster than 'while'. loop time to 1,000,000: for loop beats all; 6.42044 seconds faster than 'do-while', and 5.9986 seconds faster than 'while'. In simple conclusion, loops are a funny business and they can vary based on many probably factors. Please use the script to do the experiment yourself, as learning is always a personal endeavour! I hope this was helpful at least to someone, and that it might lead to better scripting habits in the future for all. Have a good one! default { touch_start(integer total_number) { if(llDetectedKey(0) == llGetOwner()) { llOwnerSay("Beginning loop test.\n "); integer i = 0; llResetTime(); for(i; i < 100; i += 1){} llOwnerSay("'for' loop time to 100: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 1000; i += 1){} llOwnerSay("'for' loop time to 1,000: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 10000; i += 1){} llOwnerSay("'for' loop time to 10,000: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 100000; i += 1){} llOwnerSay("'for' loop time to 100,000: "+(string)llGetTime()); i = 0; llResetTime(); for(i; i < 1000000; i += 1){} llOwnerSay("'for' loop time to 1,000,000: "+(string)llGetTime()+"\n "); //----------- llSleep(2.0); //----------- i = 0; llResetTime(); do{i += 1;} while(i < 100); llOwnerSay("'do-while' loop time to 100: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 1000); llOwnerSay("'do-while' loop time to 1,000: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 10000); llOwnerSay("'do-while' loop time to 10,000: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 100000); llOwnerSay("'do-while' loop time to 100,000: "+(string)llGetTime()); i = 0; llResetTime(); do{i += 1;} while(i < 1000000); llOwnerSay("'do-while' loop time to 1,000,000: "+(string)llGetTime() + "\n "); //----------- llSleep(2.0); //----------- i = 0; llResetTime(); while(i < 100){i += 1;} llOwnerSay("'while' loop time to 100: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 1000){i += 1;} llOwnerSay("'while' loop time to 1,000: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 10000){i += 1;} llOwnerSay("'while' loop time to 10,000: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 100000){i += 1;} llOwnerSay("'while' loop time to 100,000: "+(string)llGetTime()); i = 0; llResetTime(); while(i < 1000000){i += 1;} llOwnerSay("'while' loop time to 1,000,000: "+(string)llGetTime()); } } }
×
×
  • Create New...