johnpgr / rinha-2024-q1-vlang Goto Github PK
View Code? Open in Web Editor NEWRinha de backend 2024 q1 usando Vlang
Rinha de backend 2024 q1 usando Vlang
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')
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())!
I suggested use C gettime function with a faster clock ID, already in UTC format to help in json encode, too
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"]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.