Code Monkey home page Code Monkey logo

Comments (6)

DonSchado avatar DonSchado commented on May 18, 2024

interesting issue, would really like to see a solution when you've found the time.

from rack-tracker.

fabn avatar fabn commented on May 18, 2024

This is partially fixed by #53 but it only handle the </head> case (unless the literal appears in head itself maybe as a comment).

It won't handle the case when tracking code is added to </body> and html document contains a literal </body>, that would require a different approach.

In any case using sub! instead of gsub! is definitely an improvement over the current situation.

from rack-tracker.

fabn avatar fabn commented on May 18, 2024

I think that the only way to reliably detect head and body tag would be an html parser but I'm afraid that it will add too much overhead to being done in a middleware.

from rack-tracker.

DonSchado avatar DonSchado commented on May 18, 2024

no, I think your right. Depends on how reliable it needs to be, or if we can get to a state where it's good enough without an impact on performance.

from rack-tracker.

DonSchado avatar DonSchado commented on May 18, 2024

So I did some benchmarks on this,
injecting 2 handlers same time, one append head, one append body.

And in fact with something like nokogiri,
the code is indeed much nicer,
but will add round about 50ms for a mid sized html dom, compared to sub!.
(this one for example: https://en.wikipedia.org/wiki/Alan_Turing)

I think that's not acceptable for most apps.
Rack Tracker seems to add alone round about 10ms to a request (same setup...).

If we could come up with a more rubust pattern matcher,
I think we could avoid most ambiguous matches,
by still keep a low impact on performance.

from rack-tracker.

bumi avatar bumi commented on May 18, 2024

I guess we have to add a "won't fix" label here. Any solution discussed would have quite some other downsides, so I guess the current implementation is the best we have right now - and works (mostly)
if anybody has some more ideas, please open the issue again! thanks!

from rack-tracker.

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.