Giter Site home page Giter Site logo

Comments (2)

JoeKar avatar JoeKar commented on June 9, 2024

If we convert all those map accesses to simple struct field accesses (e.g. b.diffgutter), it should work much faster. (And we may still keep the map representation as well, e.g. for compatibility with plugins, just not use it inside micro itself all the time.)

Hm, but only for a subset or am I wrong? Otherwise we maintain all settings twice. At least I don't know any representation of such an map in a transparent way as simple structure members...
The map definitely has one large pro, when it comes to the option lookup inside the infopane for the autocompletion.

from micro.

dmaluka avatar dmaluka commented on June 9, 2024

Otherwise we maintain all settings twice.

Yes, we maintain all settings twice, that's the idea. When setting an option value, we update both the struct field and the map, but when getting its value (which we do much more often), we only need to read the struct field.

At least I don't know any representation of such an map in a transparent way as simple structure members...

There is none, so we'd need to maintain both representations. But while we're at it, I guess we can use Go reflection to convert between both representations more or less automatically.

The map definitely has one large pro, when it comes to the option lookup inside the infopane for the autocompletion.

Yes, for option name validation, autocompletion etc we need a list of option name strings, in one form or another, not necessarily as a map. But for compatibility with plugins that read an option value directly from the map as bp.Buf.Settings["foo"] we need it to be a map. (BTW it seems this means we cannot make it compatible with those plugins that try to write it directly via bp.Buf.Settings["foo"] = "bar", if there are any).

from micro.

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.