Results 1 to 2 of 2

Thread: Ext.string.format v/s String concatenate operation

  1. #1
    Sencha User
    Join Date
    Oct 2013
    Posts
    200
    Answers
    3

    Default Ext.string.format v/s String concatenate operation

    Hi,

    I am using some concatenation operations in my extjs code -

    sample 1 - var str = string1 + '-' string2 + '-' + string3 + ...
    sample 2 - var str = Ext.String.format('{0} - {1} - {2}', string1, string2, string3)..

    I think Ext.string.format should be more faster, but when i checked on this link -
    http://jsperf.com/ext-string-format-vs-concat
    it is showing it slower.

    can anyone please tell me which one is faster ?

    Thanks,
    Ankit

  2. #2
    Sencha - Sustaining Engineer tristan.lee's Avatar
    Join Date
    Mar 2015
    Location
    Central Ohio
    Posts
    1,579
    Answers
    165

    Default

    Hi,

    Using the native form on String concatenation is going to be faster as Ext.String.format() (http://docs.sencha.com/extjs/4.2.1/s...-method-format) uses a regular expression for token replacement.

    Thanks,
    Tristan

Similar Threads

  1. Convert the XML String into tree format
    By sridhar.boganathan in forum Ext: Q&A
    Replies: 2
    Last Post: 23 Dec 2012, 10:14 PM
  2. Replies: 1
    Last Post: 25 Sep 2012, 5:21 PM
  3. format number string
    By quinta in forum Ext 3.x: Help & Discussion
    Replies: 4
    Last Post: 30 Dec 2010, 3:37 AM
  4. Format of JSON String for paging
    By Sai Dasika in forum Ext 3.x: Help & Discussion
    Replies: 1
    Last Post: 12 Feb 2010, 3:12 AM
  5. string.format method
    By vaduros in forum Ext 1.x: Help & Discussion
    Replies: 1
    Last Post: 17 Apr 2007, 4:04 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •