GithubHelp home page GithubHelp logo

rinha-2024-q1-vlang's People

Contributors

johnpgr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

rinha-2024-q1-vlang's Issues

Use strings.builder

Não sei se isso pode afetar muito, mas experimente usar string builder ao invés de concatenação.

        debug('[${req.method}] ${req.path} - ${start.elapsed()}')

        res.write_string('HTTP/1.1 ${int(response.code)} ${response.code.str()}\r\n')

Use json2 to encode and json to decode

json2 is, probably, the best and faster option to encode. However, json2 decoding is VERY slow. I suggest use both

Here, for example

        json_obj := json2.fast_raw_decode(json_str)!.as_map()
        descricao := json_obj['descricao']!.str()
        tipo := TipoTransacao.from_str(json_obj['tipo']!.str())!

time.now() is too slow

I suggested use C gettime function with a faster clock ID, already in UTC format to help in json encode, too

dockerfile com versão fixa do V

Só para caso você fique com medo de a ultima versão quebrar na hora na rinha devido ao v up

Não testei, mas setar uma versão fixa do v lang seria algo mais ou menos assim

FROM debian

RUN apk add postgresql-dev

RUN apt-get -qq update
RUN apt-get -qy install --no-install-recommends build-essential git clang tcc postgresql-dev \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

ENV PATH=/opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

ENV GIT_SSL_NO_VERIFY=1

WORKDIR /opt/vlang

RUN git clone --depth 1 https://github.com/vlang/v /opt/vlang && make


RUN ln -s /opt/vlang/v /usr/bin/v

# choose v version `tags/weekly.2024.06`
RUN git fetch --all --tags && git checkout tags/weekly.2024.06 && make && v -version

WORKDIR /app

COPY ./src /app/src

#Create a build directory
RUN mkdir /app/bin

RUN v /app/src -prod -o /app/bin/app

ENTRYPOINT ["/app/bin/app"]

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.