- 1
https://journal.tinkoff.ru/diary-it-zhena-ekb/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+1
https://journal.tinkoff.ru/diary-it-zhena-ekb/
Хорошо устроилась
0
Хрюкни #12
._ __,
|\,../'\
,'. . `.
.-- '`.
( `' , ;
,`--' _, ,'\
,`.____ `.
/ `, |
' \, '
| / /`,
`, . ,` ./ |
' `. ,' |;,' ,@
______| | _________,_____jv______
`. `. ,'
,'_,','_,
`' `'
#1: (vanished) https://govnokod.xyz/_26863
#2: (vanished) https://govnokod.xyz/_26868
#3: https://govnokod.ru/26881 https://govnokod.xyz/_26881
#4: https://govnokod.ru/26896 https://govnokod.xyz/_26896
#5: https://govnokod.ru/26928 https://govnokod.xyz/_26928
#6: (vanished) https://govnokod.xyz/_26952
#7: https://govnokod.ru/26955 https://govnokod.xyz/_26955
#8: https://govnokod.ru/27043 https://govnokod.xyz/_27043
#9: https://govnokod.ru/27175 https://govnokod.xyz/_27175
#10: https://govnokod.ru/27472 https://govnokod.xyz/_27472
#11: https://govnokod.ru/27517 https://govnokod.xyz/_27517
0
// больше говнокодить не могу. сайт не дает мне писать коменты.
// на последок говнокод
const adapter = await navigator.gpu.requestAdapter();
const device = this.device = await adapter.requestDevice();
if (!device) {
document.body.className = 'error';
alert("No WebGPU");
return;
}
const computeShaderSource = document.getElementById("calculate").value;
const computePipeline = device.createComputePipeline({
compute: {
module: device.createShaderModule({
code: computeShaderSource,
}),
entryPoint: 'main',
},
});
просто говнокод. больше говнокодить не могу. сайт не дает мне писать коменты.
0
switch ($group) {
case 'Root':
break;
case 'Admin':
break;
case 'Accountant':
break;
case 'Manager':
break;
}
return $group;
Вот так можно проверить что ничего не надо делать
+2
// https://wandbox.org/permlink/rAilQ54oYBNsHJ3W
struct blob_p(T,alias t_xmalloc,alias t_free)
{
blob!(T)* bl_p;
size_t
getlen
(
) @trusted
in
{
assert(bl_p != null);
}
do
{
return bl_p.len;
}
T*
getdata
(
) @trusted
in
{
assert(this.bl_p != null);
}
do
{
return cast(T*)bl_p.data;
}
static bool
cmp
(
typeof(this) a,
typeof(this) b
) @trusted
in
{
assert(a.bl_p != null);
assert(b.bl_p != null);
}
do
{
if (a.bl_p.len != b.bl_p.len)
{
return false;
}
if(memcmp(cast(void*)a.bl_p.data, cast(void*)b.bl_p.data, a.bl_p.len * T.sizeof) != 0)
{
return false;
}
return true;
}
bool
cmp
(
typeof(this) a
) @trusted
in
{
assert(a.bl_p != null);
assert(this.bl_p != null);
}
do
{
if (a.bl_p.len != this.bl_p.len)
{
return false;
}
if(memcmp(cast(void*)a.bl_p.data, cast(void*)bl_p.data, a.bl_p.len * T.sizeof) != 0)
{
return false;
}
return true;
}
T opIndex(size_t i)
in
{
assert(bl_p != null);
assert(bl_p.len > i);
}
do
{
return getdata()[i];
}
~this()
/*in
{
assert (cast(void*)bl_p != null);
}
do*/
{
t_free(cast(void*)bl_p);
}
Попробовал написать на "D" своего рода "массив" с известно каким размером
+1
https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/pidigits.html
1.0 C gcc #6 0.59 2,444 1090 2.37 100% 100% 100% 98%
1.1 C++ g++ #6 0.66 5,152 986 2.63 100% 100% 100% 100%
1.2 Rust #4 0.71 2,672 799 0.73 3% 0% 0% 100%
1.2 Free Pascal #3 0.73 2,268 530 0.73 0% 0% 100% 0%
1.4 F# .NET #6 0.82 34,428 905 0.83 1% 2% 96% 1%
1.4 Haskell GHC #5 0.83 6,056 928 0.84 0% 99% 1% 1%
1.5 Ada 2012 GNAT 0.88 4,704 1130 0.89 0% 0% 100% 1%
1.5 Rust #2 0.88 2,800 1306 0.89 0% 1% 100% 0%
1.5 C++ g++ #4 0.89 4,280 513 0.92 0% 2% 1% 100%
1.5 OCaml #7 0.89 5,968 593 0.90 0% 0% 1% 100%
1.5 Swift #2 0.89 9,256 600 0.91 3% 0% 0% 99%
1.5 PHP #5 0.91 13,196 399 0.96 2% 0% 3% 100%
1.5 C# .NET #5 0.92 35,404 977 0.96 98% 3% 2% 1%
1.6 Java #3 0.93 36,552 764 0.98 2% 3% 1% 99%
However, Java is one of the fastest and most energy-efficient object-oriented language. Interpreted languages like Perl, Python, and Ruby were among the least energy efficient
Using the Computer Benchmarks Game, the team of researchers tested these languages by compiling/executing such programs using the state-of-the-art compilers, virtual machines, interpreters, and libraries.
They then analyzed the performance of the different implementation considering three variables: execution time, memory consumption and energy consumption.
https://jaxenter.com/energy-efficient-programming-languages-137264.html
https://jaxenter.com/wp-content/uploads/2017/09/energy-efficient-languages-768x689.png
https://jaxenter.com/wp-content/uploads/2017/09/energy-efficient-languages-2-768x368.png
−1
function* foo2() {
yield 2;
yield 3;
}
function* foo() {
yield 1;
yield* foo2();
yield 4;
}
function main() {
for (const o of foo()) {
print(o);
}
print("done.");
}
продолжаем "наговнокодить". Добавил "елдак" со "звездой". Где тут наши препроцессорописатели.. дайте аналог на C/C++.
−1
function* foo() {
let i = 1;
while (i < 10)
yield ++i;
}
function main() {
for (const o of foo()) {
print(o);
}
print("done.");
}
возрадуйтесь браться и сестры .. я вам благую весть принес... наконец-то я доделал это ..говно.. и "елдаки" теперь работают нормально.
+1
// https://github.com/mailru/confetti/blob/63ed82c65a7fbcd2baf8a67f1b7410e044dfd1dd/h_dump.c#L44
static void
dumpParamDef(FILE *fh, char* name, ParamDef *def) {
dumpComment(fh, def, 1);
switch(def->paramType) {
case int32Type:
fprintf(fh, "\tint32_t\t%s;\n", def->name);
break;
case uint32Type:
fprintf(fh, "\tu_int32_t\t%s;\n", def->name);
break;
case int64Type:
fprintf(fh, "\tint64_t\t%s;\n", def->name);
break;
case uint64Type:
fprintf(fh, "\tu_int64_t\t%s;\n", def->name);
break;
case doubleType:
fprintf(fh, "\tdouble\t%s;\n", def->name);
break;
case stringType:
fprintf(fh, "\tchar*\t%s;\n", def->name);
break;
case boolType:
fprintf(fh, "\tconfetti_bool_t\t%s;\n", def->name);
break;
case commentType:
fprintf(stderr, "Unexpected comment");
break;
case structType:
fprintf(fh, "\t%s", name);
dumpStructName(fh, def->paramValue.structval, "_");
fprintf(fh, "*\t%s;\n", def->name);
break;
case arrayType:
fprintf(fh, "\t%s", name);
dumpStructName(fh, def->paramValue.arrayval->paramValue.structval, "_");
fprintf(fh, "**\t%s;\n", def->name);
break;
case builtinType:
break;
default:
fprintf(stderr,"Unknown paramType (%d)\n", def->paramType);
exit(1);
}
}
Какое же говно эта ваша сишка. А в крестоговне эта задача легко и элегантно решается, правда ведь?
+3
var actions = new List<Action>();
foreach (var i in Enumerable.Range(1, 3))
{
actions.Add(() => Console.WriteLine(i));
}
foreach (var action in actions)
{
action();
}
По мотивам https://govnokod.ru/11946
Просто форкнул и запустил старый пример LispGovno (мир ему)
Старый пример: https://ideone.com/RaiHr
Новый пример: https://ideone.com/M1ducs
Однако получил совершенно другой результат.