$ time python3 foo.py
real 10m6.379s
user 0m0.612s
sys 0m0.174s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <sys/errno.h> | |
#include <sys/stat.h> | |
#include <sys/types.h> | |
int main() { | |
char *name = "the_file_c.txt"; | |
FILE *wf = fopen(name, "w"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2020 Google LLC | |
# | |
# Use of this source code is governed by a BSD-style | |
# license that can be found in the LICENSE file or at | |
# https://developers.google.com/open-source/licenses/bsd | |
""" | |
The code in this file provides a drop-in replacement for spanner_v1.Transaction, | |
but one that auto-refreshes every 8.5 seconds, to deal with Cloud Spanner's server's | |
max idle time of 10 seconds, per: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2020 Google LLC | |
# | |
# Use of this source code is governed by a BSD-style | |
# license that can be found in the LICENSE file or at | |
# https://developers.google.com/open-source/licenses/bsd | |
import threading | |
import time | |
from google.cloud import spanner_v1 as spanner |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from google.cloud import spanner_v1 as spanner | |
def get_instance(client): | |
ins = client.instance('django-tests') | |
fresh_instance = False | |
if not ins.exists(): | |
ins.configuration_name = 'projects/appdev-soda-spanner-staging/instanceConfigs/regional-us-west2' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io/ioutil" | |
"math" | |
"os" | |
"os/exec" | |
"path/filepath" | |
"testing" | |
"time" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BenchmarkClient-4 10000 134785 ns/op 3492 B/op 49 allocs/op | |
BenchmarkClient-4 10000 119346 ns/op 3490 B/op 49 allocs/op | |
BenchmarkClient-4 10000 126705 ns/op 3488 B/op 49 allocs/op | |
BenchmarkClient-4 10000 119080 ns/op 3488 B/op 49 allocs/op | |
BenchmarkClientServer-4 10000 106035 ns/op 4985 B/op 65 allocs/op | |
BenchmarkClientServer-4 10000 106615 ns/op 4983 B/op 65 allocs/op | |
BenchmarkClientServer-4 10000 106463 ns/op 4982 B/op 65 allocs/op | |
BenchmarkClientServer-4 10000 109390 ns/op 4983 B/op 65 allocs/op | |
BenchmarkClientServerParallel4-4 30000 76569 ns/op 7906 B/op 76 allocs/op | |
BenchmarkClientServerParallel4-4 30000 844355 ns/op 7979 B/op 78 allocs/op |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Copyright 2018, OpenCensus Authors | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
u may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright 2018, OpenCensus Authors | |
// | |
// Licensed under the Apache License, Version 2.0 (the "License"); | |
// you may not use this file except in compliance with the License. | |
// You may obtain a copy of the License at | |
// | |
// http://www.apache.org/licenses/LICENSE-2.0 | |
// | |
// Unless required by applicable law or agreed to in writing, software | |
// distributed under the License is distributed on an "AS IS" BASIS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Copyright 2018, OpenCensus Authors | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
u may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
NewerOlder