Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Merge requests
  • !123

Performance improvements

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/natefaubion/perf into master Nov 01, 2013
  • Overview 9
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: natefaubion

I ran some cpu profiles based on the sparkler specs. The three main things that stand out are

  • syntaxFromToken
  • resolveCtx
  • garbage collection

syntaxFromToken was using Object.create but was doing so in such a way that all syntax objects had unique prototypes, rather than sharing. I updated it to use a typical constructor/prototype and saw an immediate 2.5x performance gain.

I would like to look into resolveCtx but I don't fully understand the flow of it to track down what's going awry. It bounces around a lot. Like, it can go through the renaming cycle several thousands of times. Could you walk me through it, or do you have any insight into why it might be going so crazy?

There are a lot of little things all over the place that produce a lot of garbage that could add up. For example, flatten uses Array.concat even though the array is totally localized, so you gain nothing from generating all those copies. On delimiters it even has a chain of three concats, which could be combined into one since its variadic. None of these have a huge effect on their own, but do add up.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/natefaubion/perf