Support the Foreign API from project Panama

Đang mở
#717 18 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
25/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java, sqlite
Lĩnh vực
database

Hướng nghiên cứu

The issue describes a prototype that calls the sqlite3 library through Java's Foreign API and suggests generating bindings from sqlite3.h with JExtract. Start by reviewing the existing JNI implementation and the prototype described in the issue. Supporting the incubating API would require a multi-release jar; the issue does not define the broader implementation scope or completion criteria.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

wontfix

I've been playing with the Foreign API - the replacement for JNI that's been incubating since Java 14. I have managed to hack a version of the sqlite-jdbc code to use the Foreign API directly against the sqlite3 library without the need for any extra C code. The code I have is only capable of returning Strings, ints and doubles form a query.

The test I ran was

  • a table with just under 7000 rows and 27 columns.
  • query "select * from ...".
  • Run 1000 times, throw away timing from first 100

In my test, the Foreign API is about 2x faster than the existing JNI implementation. (mean of 44ms vs 23ms to retrieve all rows and columns).

My experience with the Foreign API is that when passing primitive values it's noticeably faster than JNI. When passing arrays of data the Foreign API is faster than JNI, but the gap is smaller. In other testing I've done, callback methods that call from C into Java have a similar or better speed increase (about 3.75x).

The Foreign API is only in incubator still, so it's subject to change. To support this API would require a multi-release jar. Using a tool like JExtract on sqlite3.h would do a large chunk of the translation required.

Ngôn ngữ chính
Java
Star
3.3k
Fork
676
Merge trung bình
1 ngày 15 giờ
Pull request đã merge (30 ngày)
18

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của xerial/sqlite-jdbc

Tất cả issue của xerial/sqlite-jdbc

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.