Skip to content

Instantly share code, notes, and snippets.

Avatar

Dmitry Komanov dkomanov

View GitHub Profile
View decode_simd.rs
#[no_mangle]
pub extern "system" fn decodeSimdNative(
_env: JNIEnv,
_class: JClass,
input: *const u8,
input_size: usize,
output: *mut u8,
output_size: usize,
) -> usize {
let (input_slice, output_slice) = unsafe {
View decode_slice3.rs
#[no_mangle]
pub extern "system" fn decodeConfigSliceUrlSafe3(
_env: JNIEnv,
_class: JClass,
input: *const u8,
input_size: usize,
output: *mut u8,
output_size: usize,
) -> usize {
let (input_slice, output_slice) = unsafe {
View decode_slice2.rs
#[no_mangle]
pub extern "system" fn decodeConfigSliceUrlSafe2(
env: JNIEnv,
_class: JClass,
payload: jbyteArray,
size: usize,
output: *mut u8,
output_size: usize,
) -> usize {
let arr = env.get_byte_array_elements(
View decode_slice1.rs
#[no_mangle]
pub extern "system" fn decodeConfigSliceUrlSafe1(
env: JNIEnv,
_class: JClass,
payload: jbyteArray,
size: usize,
) -> jbyteArray {
let mut buffer = Vec::<u8>::with_capacity(size * 3 / 4);
let arr = env.get_byte_array_elements(
payload,
View decode4.rs
pub extern "system" fn decodeConfigUrlSafe4(
env: JNIEnv,
_class: JClass,
payload: jbyteArray,
size: usize,
) -> jbyteArray {
let arr = env.get_primitive_array_critical(
payload,
ReleaseMode::NoCopyBack,
).unwrap();
View decode3.rs
#[no_mangle]
pub extern "system" fn decodeConfigUrlSafe3(
env: JNIEnv,
_class: JClass,
payload: jbyteArray,
size: usize,
) -> jbyteArray {
let arr = env.get_byte_array_elements(
payload,
ReleaseMode::NoCopyBack,
View decode2.rs
#[no_mangle]
pub extern "system" fn decodeConfigUrlSafe2(
env: JNIEnv,
_class: JClass,
payload: jbyteArray,
) -> jbyteArray {
let arr = env.get_byte_array_elements(
payload,
ReleaseMode::NoCopyBack,
).unwrap();
@dkomanov
dkomanov / StackTraceDirect.txt
Created May 25, 2020
[writing-async-app-in-scala-part-3] stack trace for direct
View StackTraceDirect.txt
java.lang.IllegalStateException
at com.komanov.future.examples.ExceptionDemo$.$anonfun$stackTrace$3(ExceptionDemo.scala:14)
at scala.runtime.java8.JFunction1$mcII$sp.apply(JFunction1$mcII$sp.java:23)
at scala.util.Success.$anonfun$map$1(Try.scala:255)
at scala.util.Success.map(Try.scala:213)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at com.komanov.future.package$DirectExecutor.execute(package.scala:29)
@dkomanov
dkomanov / StackTraceGlobal.txt
Created May 25, 2020
[writing-async-app-in-scala-part-3] stack trace for global
View StackTraceGlobal.txt
java.lang.IllegalStateException
at com.komanov.future.examples.ExceptionDemo$.$anonfun$stackTrace$3(ExceptionDemo.scala:14)
at scala.runtime.java8.JFunction1$mcII$sp.apply(JFunction1$mcII$sp.java:23)
at scala.util.Success.$anonfun$map$1(Try.scala:255)
at scala.util.Success.map(Try.scala:213)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
@dkomanov
dkomanov / DirectStackTraceDemo.scala
Created May 25, 2020
[writing-async-app-in-scala-part-3] demo for stack trace
View DirectStackTraceDemo.scala
def stackTrace(implicit ec: ExecutionContext): Any = {
Await.result(
Future.successful(1)
.map(v => v + 1)
.flatMap(v => Future.successful(v))
.map { v =>
new IllegalStateException().printStackTrace()
v
},
10.seconds