diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml index e2891fd..f48c12b 100644 --- a/.github/workflows/build_wheels.yml +++ b/.github/workflows/build_wheels.yml @@ -1,6 +1,8 @@ name: Build and upload to PyPI -on: push +on: + push: + workflow_dispatch: jobs: build_wheels: @@ -17,11 +19,12 @@ jobs: - uses: actions/checkout@v4 - name: Build wheels - uses: pypa/cibuildwheel@v2.16.2 + uses: pypa/cibuildwheel@v2.16.5 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: - path: ./wheelhouse/*.whl + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: wheelhouse/*.whl build_sdist: name: Build source distribution @@ -32,8 +35,9 @@ jobs: - name: Build sdist run: pipx run build --sdist - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: + name: cibw-sdist path: dist/*.tar.gz upload_pypi: @@ -44,15 +48,13 @@ jobs: url: https://pypi.org/p/mrhttp permissions: id-token: write # IMPORTANT: mandatory for trusted publishing - if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + if: startsWith(github.ref, 'refs/tags/v') # only publish to PyPI on tag pushes steps: - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - # unpacks default artifact into dist/ - # if `name: artifact` is omitted, the action will create extra parent dir - name: artifact + pattern: cibw-* path: dist + merge-multiple: true + - uses: pypa/gh-action-pypi-publish@release/v1 - # with: - # repository-url: https://test.pypi.org/legacy/ diff --git a/gbench/bld b/gbench/bld index d0e360a..8352837 100755 --- a/gbench/bld +++ b/gbench/bld @@ -1,8 +1,8 @@ # #g++ t.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o t #g++ tst.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o tst -#g++ parse.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o parse +g++ parse.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o parse #g++ string.cpp -O0 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o string #g++ query.cpp -O0 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o query -g++ rand.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o orand +#g++ rand.cpp -O3 -msse4.2 -mavx2 -std=c++11 -lbenchmark -lpthread -o orand diff --git a/gbench/parse.cpp b/gbench/parse.cpp index acbea6a..fcd28f0 100644 --- a/gbench/parse.cpp +++ b/gbench/parse.cpp @@ -116,7 +116,7 @@ std::size_t slow_hparse(std::string &text) noexcept int last = 0; int index = 0; - for (std::uint64_t i = 0; i < text.length(); i++) + for (int i = 0; i < text.length(); i++) { if ( text[i] == ':' ) { keys[index] = text.substr( last, i-last ); @@ -1234,13 +1234,13 @@ static void BM_get_session_avx2(benchmark::State& state) { //BENCHMARK(BM_SlowParse); -BENCHMARK(BM_sse4_get_eol); -BENCHMARK(BM_my_get_eol); -//BENCHMARK(BM_my3_header_parse); -//BENCHMARK(BM_my2_header_parse); +//BENCHMARK(BM_sse4_get_eol); +//BENCHMARK(BM_my_get_eol); +BENCHMARK(BM_my3_header_parse); +BENCHMARK(BM_my2_header_parse); //BENCHMARK(BM_my_header_parse); -//BENCHMARK(BM_old_header_parse); -//BENCHMARK(BM_avx2_header_parse); +BENCHMARK(BM_old_header_parse); +BENCHMARK(BM_avx2_header_parse); //BENCHMARK(BM_adv_token); //BENCHMARK(BM_adv_token_avx2); //BENCHMARK(BM_get_session); diff --git a/src/mrhttp/utils/unpack.c b/src/mrhttp/utils/unpack.c index 17d4075..eacac59 100644 --- a/src/mrhttp/utils/unpack.c +++ b/src/mrhttp/utils/unpack.c @@ -1,4 +1,5 @@ + #include "unpack.h" #include "py_defines.h" #include @@ -48,6 +49,14 @@ PyObject *decode( char *s, char *end) { o = PyUnicode_FromStringAndSize( s, l ); s += l; } + else if ( *(s) == 0x6B ) { + s++; + uint32_t *p = (uint32_t*)s; + uint32_t l = *p; + s+=4; + o = PyBytes_FromStringAndSize( s, l ); + s += l; + } else if ( *(s) == 0x61 ) { s += 1; Py_INCREF(Py_True); o = Py_True; } else if ( *(s) == 0x62 ) { s += 1; Py_INCREF(Py_False); o = Py_False; } else if ( *(s) == 0x63 ) { diff --git a/tst.py b/tst.py index 316ec00..c07898c 100755 --- a/tst.py +++ b/tst.py @@ -1,7 +1,6 @@ import traceback, mrjson from mrhttp import app -import mrpacker @app.route('/',_type='text') def index(r):