Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 106029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:31:56+00:00 2026-05-11T01:31:56+00:00

Just wondering if anyone knew off the top of their heads if there was

  • 0

Just wondering if anyone knew off the top of their heads if there was much difference in doing the following:

String wibble = '<blah> blah blah </blah>.... <wibble> blah wibble blah </wibble> some more test here';  int i = wibble.lastIndexOf('>'); int j = wibble.lastIndexOf('>'); 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:31:57+00:00Added an answer on May 11, 2026 at 1:31 am

    Opinions are great but data are better. I wrote a quick benchmark:

    Test Code

    public static void main(String[] args) {   System.out.println('Starting perfo test');    final long NUM_TESTS = 100000000L;    String wibble = '<blah> blah blah </blah>.... <wibble>'                 + ' blah wibble blah </wibble> some more test here';   int x = -1;   Stopwatch sw = new Stopwatch();    System.out.println('--perfo test with ' + NUM_TESTS + ' iterations--');    sw.start();   for(long i = 0; i < NUM_TESTS; i++)     x = wibble.lastIndexOf('>');   sw.stop();   System.out.println('String first pass: ' + sw + ' seconds');    sw.start();   for(long i = 0; i < NUM_TESTS; i++)     x = wibble.lastIndexOf('>');   sw.stop();   System.out.println('Char first pass: ' + sw + ' seconds');    sw.start();   for(long i = 0; i < NUM_TESTS; i++)     x = wibble.lastIndexOf('>');   sw.stop();   System.out.println('Char second pass: ' + sw + ' seconds');    sw.start();   for(long i = 0; i < NUM_TESTS; i++)     x = wibble.lastIndexOf('>');   sw.stop();   System.out.println('String second pass: ' + sw + ' seconds');    //Compiler warning said x was never read locally.. this is to   //ensure the compiler doesn't optimize 'x' away..   System.out.println(x);  } 

    Output

    Starting perfo test --perfo test with 100000000 iterations-- String first pass: 8.750 seconds Char first pass: 6.500 seconds Char second pass: 6.437 seconds String second pass: 8.610 seconds 63

    Conclusion

    The version with a char is about 25% faster, but both versions execute very quickly so it probably won’t ever be a bottleneck in your code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 62k
  • Answers 62k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer If there are invariants you need to preserve, then yes.… May 11, 2026 at 10:16 am
  • added an answer Perhaps I am misunderstanding the question (if so please let… May 11, 2026 at 10:16 am
  • added an answer I don't use Rails at work, but I sometimes come… May 11, 2026 at 10:16 am

Related Questions

Just wondering if anyone knew off the top of their heads if there was
just wondering if anyone knows of a truly restful Put/delete implementation asp.net mvc preview
Just wondering if anyone has any favourite SQL references they to use when creating
just wondering if anyone could suggest why I might be getting an error? I'm
I was just wondering if anyone else just sees integration tests as just a
I've just started using Linq to SQL, and I'm wondering if anyone has any
Just wondering if a .NET app can be compiled down to native machine code
Just wondering if there is an easy way to add the functionality to duplicate
Just wondering if there is any way (in C) to get the contents of
Just wondering if any of you guys know of any web-based/browser-based employee scheduling software/tools?

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.