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

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

I am not sure of this but there may be something wrong in parsing it as float.

"18446744073307448448" does not turn into a float with the value of 
18446744073307448448F
It would be impossible, since a float has 32 bits, just like a long. 

The reason we can parse "18446744073307448448" as Float is because it gets 
rounded to 18446744000000000000f

Also, that number, 18446744073307448448, is Long.MAX_VALUE * 2, for a reason I 
did not understand yet.
There may be a bug in the creator app somewhere.

We know the original number is not a float, we know it's just a very large 
integer.
I understand Float.MAX_VALUE is wrong. Does it make sense to make it /- 
Long.MAX_VALUE ?

 

> 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-4895-b.patch, PDFBOX-4895.patch
>
>
> 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