________________________________
> From: brave...@gmail.com
> Date: Thu, 22 Apr 2010 23:22:36 +0200
> To: brave...@gmail.com
> CC: itext-questions@lists.sourceforge.net
> Subject: Re: [iText-questions] performance follow up
>
>
>
> Hello,
>
> On Apr 22, 2010, at 10:59 PM, Giovanni Azua wrote:
> PRTokeniser.isWhitespace is a simple boolean condition that just happen to be
> called gazillion times e.g. 35'622'000 times for my test workload ... if
> instead of doing it like:
>
> public static final boolean isWhitespace(int ch) {
> return (ch == 0 || ch == 9 || ch == 10 || ch == 12 || ch == 13 || ch == 32);
> }
does this have to be int vs char or byte? I think earlier I suggested
operating on byte[] instead of making a bunch of temp strings
but I don't know the context well enough to know if this makes sense.
Certainly demorgan can help but casts and calls are not free either.
Also, maybe hotspot runtime has gotten better but I have found in
the past that look up tables can quickly become competititve
with bit operators ( if your param is byte instead of int, a
256 entry table can tell you if the byte is a member of which classes).
>
> we used a bitwise binary operator with the appropriate mask(s), there could
> be some good performance gain ...
>
> The function already exists in
> http://java.sun.com/javase/6/docs/api/java/lang/Character.html#isWhitespace%28char%29
> I checked and it already uses bitwise binary operators with the right masks
> ... we would only need to inline it to avoid the function call costs.
>
> Best regards,
> Giovanni
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your
inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
------------------------------------------------------------------------------
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/