• Post Reply Bookmark Topic Watch Topic
  • New Topic

Fastest/efficient way to process bits  RSS feed

 
J.D. Thompson
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • 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
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24215
37
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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.
 
Norm Radder
Rancher
Posts: 1733
22
  • Mark post as helpful
  • send pies
  • 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?
 
steve souza
Ranch Hand
Posts: 862
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should profile your code.
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!