• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Fastest/efficient way to process bits

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am looking into finding a way to improve the current speed of an application I am working on. The major hangup right now is the reading of bits from a TCP socket.

The current application basically reads into a byte array, decodes, flips, and then appends a StringBuilder buffer. This buffer is then regex'd to see if a new message has arrived.

Is there a better technique, perhaps at the bit level, that I could look into adapting and using?

Currently, we handle a maximum of 5 messages per sec where each message is approx 160 bytes. I would like to improve this through a better read to 8 or greater.

Thanks for your feedback and thoughts!!!

JD
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Processing 160 bytes in a second is really slow; I wonder what's going on. Assuming that the bytes are coming off the socket faster than that, of course.

Could we see some of the code that does this processing, to give us a better idea of what we're talking about?

I'm going to move this to our "Performance" forum, where I hope we'll continue the discussion.
 
Rancher
Posts: 4739
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you checked the sender to see if it could be the problem.
Have you tried writing a trivial program to do the reading that only reads the bytes and timed its rate?
 
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should profile your code.
 
Ranch Hand
Posts: 443
3
Eclipse IDE C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you use Apache MINA ?? Then you can just add a filter for validation, it should be really simple to knock up a test app, compared to doing NIO yourself its a much happier place to be ;-) and if nothing else it'll prove if your code has a performance problem ie. if the MINA version is ok then its your code thats the problem.
 
Doe, a deer, a female deer. Ray, a pockeful of sun. Me, a name, I call my tiny ad ...
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic