Git Product home page Git Product logo

Comments (12)

bourgesl avatar bourgesl commented on May 18, 2024 1

Of course, I will fix that problem soon.
FYI I recommend using Marlin double precision (default in jdk10):
Dsun.java2d.renderer=org.marlin.pisces.DMarlinRenderingEngine
Hope it is a workaround for now

from marlin-renderer.

bourgesl avatar bourgesl commented on May 18, 2024 1

Double vs Float ~ 1% perf difference, but higher quality on x86 64bits processors.

I never made any benchmark on 32bits or embedded systems (pi, arm, powerpc...)

Anyway this numerical issue is still possible but for larger numbers with double values.
I will test with increasing line length to establish the limit.

from marlin-renderer.

bourgesl avatar bourgesl commented on May 18, 2024 1

Thanks for the information.

Marlin 0.9.3 performs path clipping in dasher so it should only emit dashes for the visible portion, already.
Your timings make me think that the long clipped line is not properly ignored due to the numerical precision issue, we talked about.
I will definitely study this interesting case,
Thanks

from marlin-renderer.

bourgesl avatar bourgesl commented on May 18, 2024 1

I took few minutes to check your problem and your test does not use Marlin renderer as RenderingHints.VALUE_ANTIALIAS_ON is missing !

EndlessLoop.java.txt

I fixed the test to use larger length (up to 7e15) and Marlin renderer rocks (both Float/Double variants) on JDK8:

  • noAA ie not Marlin renderer (native C renderer ?)
    drawLine(1.0E8) [AA=false]: 3631.4947909999996 ms.
  • AA org.marlin.pisces.DMarlinRenderingEngine:
    drawLine(1.0E8) [AA=true]: 42.381105 ms.
    drawLine(1.0E8) [AA=true]: 1.86741 ms.
  • AA org.marlin.pisces.MarlinRenderingEngine:
    drawLine(1.0E8) [AA=true]: 50.357248999999996 ms.
    drawLine(1.0E8) [AA=true]: 1.935198 ms.
    drawLine(7.0E15) [AA=true]: 48.779185999999996 ms.
    drawLine(7.0E15) [AA=true]: 1.946686 ms.

Marlin path clipper is working like a charm !

from marlin-renderer.

bourgesl avatar bourgesl commented on May 18, 2024

Could you give your command line to let me know which Marlin renderer and settings you use ?

It is surely related to a numerical precision issue when clipping the segment to the clip rectangle: I will see how to ensure clipped parts are outside the clip...

Thanks for your feedback,
Laurent

from marlin-renderer.

Matze2 avatar Matze2 commented on May 18, 2024

Here you are. Since I am in the office now this time using Windows and AdoptOpenJDK

C:\Program Files\Java\jdk8u192-b12\jre\bin>.\java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_192-b12)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.192-b12, mixed mode)

The command line I used is

"C:\Program Files\Java\jdk8u192-b12\bin\java.exe" -Dsun.java2d.renderer=org.marlin.pisces.MarlinRenderingEngine -Xbootclasspath/a:C:\Users\matze\Downloads\marlin-0.9.3-Unsafe.jar -classpath C:\Users\matze\eclipse-workspace\simple\target\classes matze.EndlessLoop

Side note that you understand from where we came:
Initially we had the problem that JFreeChart was calling Dasher.lineTo(NaN, NaN) which also blocked with Pisces. This was the reason why we are trying Marlin now.
Of course nobody would draw a line of this size by intention but having a thread cycling with 100% CPU when triggering this scenario can be critical for the whole host when you think about web applications.

Thanks for your efforts!

from marlin-renderer.

Matze2 avatar Matze2 commented on May 18, 2024

Thanks, Laurent!
I already wondered why not using DMarlinRenderingEngine. Are there any drawbacks, e.g. performance-wise?

from marlin-renderer.

bourgesl avatar bourgesl commented on May 18, 2024

Do you confirm that your problem do not happen with Marlin Double precision ?

It gives me more time to fix the precision issue...

from marlin-renderer.

Matze2 avatar Matze2 commented on May 18, 2024

Yes it works with DMarlinRenderingEngine for these values but of course takes some time.

Here some numbers:

Drawing a line to y=4.0E7
1541670292910: If you don't see 'Not hanging.' then you hang :)
1541670295111: Not hanging.
Around 2 seconds for 4.0E7.

Drawing a line to y=1.0E8
1541670374510: If you don't see 'Not hanging.' then you hang :)
1541670379637: Not hanging.
Around 5 seconds for 1.0E8.

Drawing a line to y=1.0E9
1541670807124: If you don't see 'Not hanging.' then you hang :)
1541670855332: Not hanging.
Around 48 seconds for 1.0E9.

So even if it is not hanging infinitely it can take arbitrarily long on erratic values. Therefore it would be best to only draw the portion that is "visible". Not sure if something like this is possible.

After some discussion with my colleagues we will use DMarlinRenderingEngine anyway. So this constructed case is not an issue for us, i.e. not urgent.

from marlin-renderer.

Matze2 avatar Matze2 commented on May 18, 2024

Confirmed. Sorry, I was not aware that I have to give also the "antialiasing" hint on top of of boot classpath and system property.

I could not find a place where this is documented that only the hint "really" enables the renderer.
Maybe this should be added to the "How to use" page.

In our case we just need to find a why how to enable antialiasing in all cases since in our scenario we do not access Graphics2D directly but behind libraries like JFreeChart in our case.

But issue itself is of course solved and can be closed. Thank you very much for your help!

from marlin-renderer.

bourgesl avatar bourgesl commented on May 18, 2024

See Marlin renderer description:
"Marlin is the FAST Java2D antialiasing rasterizer derived from OpenJDK Pisces (shape) "

For JFreechart, it is easy (since 2005):
Map hints = new HashMap();
hints.put(RenderingHints.KEY_ANTIALIASING,
...
chart.setRenderingHints(new RenderingHints(hints));

PS: what is your application ? (public ?)

from marlin-renderer.

Matze2 avatar Matze2 commented on May 18, 2024

No not public.
This is currently a research about the general strategy what we will do with Java 8 in 2019.

from marlin-renderer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.