Loop Performance Issue with toUpperCase() menu

User Tag List

Results 1 to 2 of 2
  1. #1
    YreiauW's Avatar Active Member
    Reputation
    19
    Join Date
    Jul 2022
    Posts
    9
    Thanks G/R
    2/2
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Loop Performance Issue with toUpperCase()

    Hello to everyone.

    I'm attempting to use the toUpperCase() function to convert a huge array of strings to uppercase. However, the process appears to be taking longer than planned, and I fear it may be affecting the performance of my application, which is unusual, so I checked through many documents but couldn't figure it out, so I found this post by scaler. Here's a condensed version of my code:
    Code:
    let inputArray = ["apple", "banana", "cherry", ...]; // Around 10,000 elements
    let uppercaseArray = [];
    
    for (let item of inputArray) {
        uppercaseArray.push(item.toUpperCase());
    }
    
    console.log(uppercaseArray);
    Is there a faster way to apply the toUpperCase() function to a full array without sacrificing performance?

    I appreciate your assistance and recommendations!

    Loop Performance Issue with toUpperCase()
  2. #2
    stoneharry's Avatar Moderator Harry

    Authenticator enabled
    Reputation
    1613
    Join Date
    Sep 2007
    Posts
    4,554
    Thanks G/R
    151/146
    Trade Feedback
    0 (0%)
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    This does not seem to be a WoW emu specific problem.

    The general advise for expensive logic is to parallelise it where possible.

    So instead of having 1 loop that converts each item, use a algorithm like map reduce.

    Map -> toUpperCase -> Split over many threads.
    Reduce -> collect results until you have a single array

    MapReduce - Wikipedia

  3. Thanks hackerlol (1 members gave Thanks to stoneharry for this useful post)

Similar Threads

  1. [Request] Issue with Gnome Male > BE Female
    By Borbei in forum WoW ME Questions and Requests
    Replies: 1
    Last Post: 10-13-2007, 05:42 PM
  2. [Question] Camera Issue with Model Editing.
    By Frombehind in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 10-12-2007, 03:57 PM
  3. am having issues with Chrispee's antrix
    By krisfahnz in forum World of Warcraft Emulator Servers
    Replies: 4
    Last Post: 09-09-2007, 01:32 PM
  4. Issue with starting Antrix.exe
    By LampShade in forum World of Warcraft Emulator Servers
    Replies: 2
    Last Post: 08-30-2007, 04:00 AM
  5. Issues with Deeprun Tram exploit
    By shade599 in forum World of Warcraft Exploration
    Replies: 3
    Last Post: 03-25-2007, 08:01 AM
All times are GMT -5. The time now is 06:34 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search