[ 
https://issues.apache.org/jira/browse/PDFBOX-4895?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17165228#comment-17165228
 ] 

Alfred commented on PDFBOX-4895:
--------------------------------

I brought up that file because it's one of the files that has very large 
numbers.

You were looking for the best way to handle to stay as close to the spec as 
possible.
I wanted to point out that there's probably something they do differently.
I tried ZERO, null, +/- max long, +/- max float but none of them produced a 
significantly better result.
So there are other differences too, not just the cos number.
I can't figure out what it is.

But none of the values I tried did better than null.
And considering you have to run a regex to decide between null and exception, 
it may be ok to just return null all the time.

I am fine either way.

> Faster COSNumber
> ----------------
>
>                 Key: PDFBOX-4895
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4895
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 2.0.20, 3.0.0 PDFBox
>            Reporter: Alfred
>            Assignee: Tilman Hausherr
>            Priority: Trivial
>              Labels: Optimization
>             Fix For: 2.0.21, 3.0.0 PDFBox
>
>         Attachments: PDFBOX-3703-966635-p12.pdf-1.png, PDFBOX-4895-b.patch, 
> PDFBOX-4895.patch, Untitled.png
>
>
> A small improvement can be made to COSNumber when checking if it's float.
> Current version uses indexOf twice, to check for '.' or 'e'.
>  We can do that in one scan.
>  
> Each call will scan through the entire string.
>  We only have to scan until we find the chars, and stop if found.
>  
> I found while profiling the code that the method gets called a lot, so the 
> improvement makes a a bit of a difference.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org
For additional commands, e-mail: dev-h...@pdfbox.apache.org

Reply via email to